Skip to content

fix(ci): open publish-dist PRs with ak2k-ci App token so auto-merge fires#32

Merged
ak2k merged 1 commit into
mainfrom
ci-app-token-automerge
May 25, 2026
Merged

fix(ci): open publish-dist PRs with ak2k-ci App token so auto-merge fires#32
ak2k merged 1 commit into
mainfrom
ci-app-token-automerge

Conversation

@ak2k

@ak2k ak2k commented May 25, 2026

Copy link
Copy Markdown
Owner

Why

publish-dist opened its auto-PR with the default GITHUB_TOKEN. GitHub suppresses every event for a PR created by GITHUB_TOKEN — including pull_request_target — so ci.yml never ran on the auto-PR and auto-merge-publish-dist's gate (a green nix flake check on the PR head) was never satisfiable. Result: auto-merge has never closed the loop — every bump (including #31, just now) needed a manual merge. The converter fix unblocked the run; this is the second broken link.

What

  • publish-dist.yml: mint a short-lived ak2k-ci App token (actions/create-github-app-token@v3) and pass it to peter-evans/create-pull-request. ci.yml triggers on pull_request, so an App-token PR runs ci naturally → workflow_run: ci → auto-merge Phase 2 direct-merges when green.
  • auto-merge-publish-dist.yml: fix the comment that wrongly claimed pull_request_target fires for GITHUB_TOKEN PRs; note Phase 1 is now a redundant fallback.

nix flake check (actionlint + treefmt + pytest) passes locally.

⚠️ Prerequisites — do these BEFORE merging

This change is inert (and would break publish-dist at the token step) until both are in place:

  1. Install the ak2k-ci App on ak2k/ce-lite with contents: write + pull-requests: write.
  2. Add two repo secrets (key is in your nix-config sops secrets/ci.yaml):
    gh secret set CI_APP_ID          -R ak2k/ce-lite   # ak2k-ci App ID
    gh secret set CI_APP_PRIVATE_KEY -R ak2k/ce-lite < ak2k-ci.private-key.pem

Once set, the next upstream release self-completes: cron → publish-dist → App-token PR → ci → auto-merge.

publish-dist's peter-evans/create-pull-request step used the default
GITHUB_TOKEN. GitHub suppresses ALL events for a PR opened by
GITHUB_TOKEN -- including pull_request_target -- so ci.yml never ran on
the auto-PR and auto-merge-publish-dist's gate (a green `nix flake check`
on the PR head) was never satisfied. Every bump has needed a manual
merge; auto-merge has effectively never closed the loop.

Mint a short-lived ak2k-ci App installation token
(actions/create-github-app-token@v3) and hand it to peter-evans. ci.yml
triggers on pull_request, so an App-token PR runs ci naturally ->
workflow_run: ci -> Phase 2 direct-merges when green. Phase 1's
pull_request_target dispatch is now a redundant fallback. Also corrected
the auto-merge header comment, which wrongly claimed pull_request_target
fires for GITHUB_TOKEN PRs.

Requires repo secrets CI_APP_ID + CI_APP_PRIVATE_KEY and the ak2k-ci App
installed on ak2k/ce-lite (contents + pull-requests write). Merge only
after those are in place -- otherwise publish-dist fails at the token step.
@ak2k ak2k merged commit 2537049 into main May 25, 2026
2 checks passed
@ak2k ak2k deleted the ci-app-token-automerge branch May 25, 2026 13:44
ak2k added a commit that referenced this pull request May 26, 2026
…e pitfall (#33)

- Add a "Workflow pitfalls" note: measure idle cost via interactive
  /context (the Custom agents slot), NOT `claude plugin details` -- the
  latter's Always-on projection counts agent descriptions (~50 tok/agent)
  and misses the loaded bodies (~2k/agent), under-reporting by ~15x.
- Refresh the publish-dist pitfall: it claimed ci.yml doesn't run on
  auto-PRs and "those checks are the validation signal" -- stale since
  PR #32 wired the ak2k-ci App token, which makes the auto-PR fire
  pull_request -> ci -> auto-merge. Documents the App-token mechanism.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant